package com.yzs.exam.repository;


import com.yzs.exam.entity.User;
import com.yzs.exam.entity.other.KeyValue;
import com.yzs.exam.viewmodel.admin.user.UserPageRequestVM;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author yzs
 * @create 2021-03-15 20:19
 */
@Repository
@Mapper
public interface UserMapper extends BaseMapper<User> {
    //把T确定位User
    int deleteByPrimaryKey(Integer id);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);


    List<User> getAllUser();

    User getUserById(Integer id);

    User getUserByUserName(String username);

    /**
     * 获取用户名和密码
     * @param username
     * @param pwd
     * @return
     */
    User getUserByUserNamePwd(@Param("username") String username, @Param("pwd") String pwd);

    User getUserByUuid(String uuid);

    List<User> userPageList(Map<String, Object> map);

    Integer userPageCount(Map<String, Object> map);

    List<User> userPage(UserPageRequestVM requestVM);

    void insertUser(User user);

    void insertUsers(List<User> users);

    void updateUser(User user);

    void updateUsersAge(Map<String, Object> map);

    void deleteUsersByIds(List<Integer> ids);

//    void insertUserSql(User user);

    Integer selectAllCount();

    List<KeyValue> selectByUserName(String userName);

    List<User> selectByIds(List<Integer> ids);


    User selectByWxOpenId(@Param("wxOpenId") String wxOpenId);
}
